package com.zhentao.service.impl;

import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.zhentao.model.common.dtos.ResponseResult;
import com.zhentao.model.common.manger.pojo.Banner;
import com.zhentao.service.BannerService;
import com.zhentao.mapper.BannerMapper;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.util.List;

/**
* @author lenovo
* @description 针对表【banner】的数据库操作Service实现
* @createDate 2024-09-27 11:45:46
*/
@Service
public class BannerServiceImpl extends ServiceImpl<BannerMapper, Banner>
    implements BannerService{
    @Resource
    private BannerMapper bannerMapper;

    @Override
    public ResponseResult getBanner() {
        LambdaQueryWrapper<Banner> queryWrapper = new LambdaQueryWrapper<>();
        queryWrapper.orderByDesc(Banner::getSort);
        queryWrapper.eq(Banner::getStatus,1);
        List<Banner> banners = bannerMapper.selectList(queryWrapper);
        return ResponseResult.okResult(banners);
    }
}




